package com.cn.kehong.controller;


import com.cn.kehong.api.IThroughRateDetailService;
import com.cn.kehong.domain.ThroughRateDetail;
import com.cn.kehong.utils.JsonResponse;
import com.cn.kehong.utils.QueryForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/rateDetail")
public class ThroughRateDetailController {

    @Autowired
    private IThroughRateDetailService throughRateDetailService;
    @RequestMapping("/getThroughRateDetailsByRateId/{frontToken}")
    @ResponseBody
    public JsonResponse<List<ThroughRateDetail>> getThroughRateDetailsByRateId(String rateId, @PathVariable(value = "frontToken",required = true) String frontToken) throws Exception {
        JsonResponse<List<ThroughRateDetail>> response = new JsonResponse<List<ThroughRateDetail>>();
        List<ThroughRateDetail> list  = throughRateDetailService.getThroughRateDetailsByRateId(rateId);
        response.setResult(list);
        response.setSuccess(true);
        return  response;
    }

    @RequestMapping("/getThroughRateDetailsByKb")
    @ResponseBody
    public JsonResponse<List<ThroughRateDetail>> getThroughRateDetailsByKb(QueryForm queryForm) throws Exception {
        JsonResponse<List<ThroughRateDetail>> response = new JsonResponse<List<ThroughRateDetail>>();
        List<ThroughRateDetail> list  = throughRateDetailService.getThroughRateDetailsByKb(queryForm);
        response.setResult(list);
        response.setSuccess(true);
        return  response;
    }
}
